package com.project.server.utils;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.ocr.v20181119.OcrClient;
import com.tencentcloudapi.ocr.v20181119.models.LicensePlateOCRRequest;
import com.tencentcloudapi.ocr.v20181119.models.LicensePlateOCRResponse;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @ClassName: test
 * @Author: Oww
 * @Date: 2021/6/24　15:47
 * @Description：
 */
public class test {
    public static void main(String[] args) throws ParseException {

        /*int[] arr = {1, 2, 3};

        System.out.println(arr[2]);

        System.out.println(arr.length);

        String str = "qewrhfsjfb";

        System.out.println("str.length()"+str.length());
        List list = new ArrayList();

        list.add("1");
        list.add("2");
        list.add("3");
        list.add(1);

        System.out.println(list.get(0));*/
        try{
            Credential cred = new Credential("AKIDNdhW6RXO0PclkX8XieLnzwe6JGxPcbLq", "JNCm7E6j9KGxPbYGjxwf9PQBhy0nLhog");

            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("ocr.tencentcloudapi.com");

            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);

            OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile);

            LicensePlateOCRRequest req = new LicensePlateOCRRequest();
            req.setImageUrl("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.sdchina.com%2FUsersFiles%2Fnews%2F2011%2F01%2F17%2F20110117150952444.jpg&refer=http%3A%2F%2Fimg.sdchina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627825781&t=bcdf71672d55d34b85fb9340d47c9b70");
            LicensePlateOCRResponse resp = client.LicensePlateOCR(req);

            System.out.println(LicensePlateOCRResponse.toJsonString(resp));
        } catch (TencentCloudSDKException e) {
            System.out.println(e.toString());
        }

        List<String> list = Arrays.asList("am");
        List arrayList = new ArrayList(list);
        List<String> newList = Arrays.asList("Hi", "I", "am", "Henry.Yao");
        List newArrayList = new ArrayList(newList);

        if (arrayList != null) {
            for (int i = 0; i < arrayList.size(); i++) {
                boolean isContains = newArrayList.contains(arrayList.get(i));
                if (isContains) {
                    newArrayList.remove(newArrayList.indexOf(arrayList.get(i)));
                }
            }
        }
        System.out.println(newArrayList);

    }
}
